package com.safezh.handler;

import com.xiaoleilu.hutool.db.handler.BeanListHandler;
import com.xiaoleilu.hutool.db.handler.HandleHelper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @version 1.0
 * @ClassName:CustomBeanListHandler
 * @Description:TODO(用一句话描述该文件做什么)
 * @date:2018年01月04日
 * @since JDK 1.7
 */
public class CustomBeanListHandler<E> extends BeanListHandler<E> {
    private Class<E> elementBeanType;
    /**
     * 构造
     *
     * @param beanType Bean类型
     */
    public CustomBeanListHandler(Class<E> beanType) {
        super(beanType);
        this.elementBeanType = beanType;
    }

    @Override
    public List<E> handle(ResultSet rs) throws SQLException {
        return CustomHandleHelper.handleRsToBeanList(rs, new ArrayList<E>(), elementBeanType);
    }
}
